// 大文件传输测试
#include <iostream>
#include "../Server/Server.hpp"
#include "../Server/Http/Http.hpp"

int main()
{
    TcpSocket client_socket;
    client_socket.ClientCreate("127.0.0.1", 8080);
    std::string req = "PUT /6666.txt HTTP/1.1\r\nConnection: keep-alive\r\n";
    std::string body;
    Tool::ReadFile("./send.txt", body);
    req += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n";
    DEBUG_LOG("body_size:%ld", body.size());

    assert(client_socket.Send(req.c_str(), req.size()) >= 0);
    assert(client_socket.Send(body.c_str(), body.size()) >= 0);
    char buffer[1024] = {0};
    assert(client_socket.Recv(buffer, sizeof(buffer) - 1) >= 0);
    DEBUG_LOG("[%s]", buffer);

    client_socket.Close();
    return 0;
}